<?php $__env->startSection('title','修改专家页'); ?>
<?php $__env->startSection('content'); ?>
    <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
        <div class="col-md-12" id="content">
            <div class="app_content_div" id="app_content_div_301Index">
                <h3>修改专家</h3>
            </div>
            <form class="form-horizontal" >
                <?php echo csrf_field(); ?>
                <div class="form-group">
                    <label for="name" class="col-sm-2 control-label"><span style="color:red;">*</span>姓名</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control" id="name" name="name" value="<?php echo e($oExperts->name); ?>">
                    </div>
                </div>
                <div class="form-group">
                    <label for="upload_file" class="col-sm-2 control-label"><span style="color:red;">*</span>缩略图</label>
                    <div class="col-sm-10">
                        <input type="file" name="thumb" id="thumb" onchange="previewImage()" >
                        <div id="image-container"></div>
                    </div>
                </div>


                <div class="form-group">
                    <label for="department" class="col-sm-2 control-label"><span style="color:red;">*</span>科室</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control" id="keshi" name="keshi" value="<?php echo e($oExperts->keshi); ?>">
                    </div>
                </div>
                <div class="form-group">
                    <label for="title" class="col-sm-2 control-label"><span style="color:red;">*</span>职称</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control" id="zhicheng" name="zhicheng" value="<?php echo e($oExperts->zhicheng); ?>">
                    </div>
                </div>
                <div class="form-group">
                    <label for="postion" class="col-sm-2 control-label"><span style="color:red;">*</span>职务</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control" id="zhiwu" name="zhiwu" value="<?php echo e($oExperts->zhiwu); ?>">
                    </div>
                </div>
                <div class="form-group">
                    <label for="hospital" class="col-sm-2 control-label"><span style="color:red;">*</span>医院</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control" id="yiyuan" name="yiyuan" value="<?php echo e($oExperts->yiyuan); ?>">
                    </div>
                </div>
                <div class="form-group">
                    <label for="description" class="col-sm-2 control-label"><span style="color:red;">*</span>简介</label>
                    <div class="col-sm-10">
                        <script id="jianli"  type="text/plain"><?php echo e($oExperts->introduce); ?></script>
                    </div>
                </div>
                <script type="text/javascript">
                    var ue3 = UE.getEditor('jianli',{
                        elementPathEnabled: false,
                        saveInterval: 5000
                    });
                </script>
                <div class="form-group">
                    <label for="hospital" class="col-sm-2 control-label"><span style="color:red;">*</span>接受教育</label>
                    <div class="col-sm-10">
                        <script id="edu"  type="text/plain"><?php echo e($oExperts->education); ?></script>
                    </div>
                </div>
                <script type="text/javascript">
                    var ue4 = UE.getEditor('edu',{
                        elementPathEnabled: false,
                        saveInterval: 5000
                    });
                </script>

                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                        <button type="button" onclick="edit()" class="btn btn-default">确定</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
    <script>
        function edit(){
            var name = $('#name').val();
            var keshi = $('#keshi').val();
            var zhicheng = $('#zhicheng').val();
            var zhiwu = $('#zhiwu').val();
            var yiyuan = $('#yiyuan').val();
            let introduce=ue3.getContentTxt();
            let education=ue4.getContentTxt();
            var _token = "<?php echo e(csrf_token()); ?>";
            
            
            
            
            
            
            
            
            
            
            
            
            

            


            
            $.ajaxFileUpload({
                url: '/adm/expert/edit/<?php echo e($oExperts->id); ?>',
                type: 'post',
                fileElementId:'thumb',
                dataType: 'json',
                data: {
                    'name': name, 'keshi': keshi,
                    'zhicheng': zhicheng, 'yiyuan': yiyuan,
                    'introduce': introduce, 'zhiwu': zhiwu, 'education': education,
                    '_token': _token
                },

                success:function (data) {
                    if (data.success) {
                        alert("修改成功");
                        location.href = '/adm/expertlist';
                    } else {
                        alert(data.msg);
                    }
                }


            });
        }
    </script>
    <script>
        function previewImage() {
            var file = document.getElementById("thumb").files[0];
            var reader = new FileReader();
            reader.onload = function(e) {
                var img = document.createElement("img");
                img.src = e.target.result;
                img.width = 200; // 设置宽度为200像素
                img.height = 200; // 设置高度为200像素
                document.getElementById('image-container').appendChild(img);
            }
            reader.readAsDataURL(file);
        }

    </script>




<?php $__env->stopSection(); ?>

<?php echo $__env->make('admin.layout', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\Users\xinyi\Desktop\510\resources\views/admin/expert-edit.blade.php ENDPATH**/ ?>